<!doctype html>
<html lang="zh-CN">
	<head>
		<!-- 必须的 meta 标签 -->
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

		<!-- Bootstrap 的 CSS 文件 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
		<title>注册</title>
		<style type="text/css">
			.loginPannel{
				width:500px;
				margin:30px auto; 
			}
			.loginPannel h3{text-align: center;}
		</style>
	</head>
	<body>
		<div class="loginPannel" id="app"> 
			<h3>注册</h3>
			<form>
				<div class="form-group">
					<label for="exampleInputEmail1">账号</label>
					<input type="text" class="form-control" v-model="form.userName" id="exampleInputEmail1">
					<small id="emailHelp" class="form-text text-muted"> </small>
				</div>
				<div class="form-group">
					<label for="exampleInputPassword1">密码</label>
					<input type="password" class="form-control" v-model="form.password"  id="exampleInputPassword1">
				</div>
				<button type="button" class="btn btn-primary" @click="register">注册</button>
			</form>
		</div>
 
		  <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
		  <!-- <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
		  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" integrity="sha384-qtoqgtVysUOibC/YeVgpOyLJpelAT1DHvg98mYHqq8ofXEmNEjaNqOZwnMKxlXCy" crossorigin="anonymous"></script>
		 -->
		 
		<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
		<script type="text/javascript">
			var app2 = new Vue({
				el: '#app',
				data: {
					form:{
						userName:'',
						password:''
					} 
				},
				methods:{
					register(){
						 $.ajax({
								url:'/api/register',
								type:'post',
								dataType:'json',
								data:this.form,
								success:function(data,status){   
									console.log(JSON.stringify(data),status);
										if(data.code==200)alert("注册成功")      
								} 
							}); 
					}
				}
			})
		</script>
	</body>
</html>
